package cn.ronghui.project.domain.application.model.entity;

import cn.ronghui.project.types.enums.AppliStatusEnumVO;
import cn.ronghui.project.types.enums.RoomStatusEnumVO;
import cn.ronghui.project.types.enums.RoomTypeEnumVO;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.RandomStringUtils;
import org.springframework.format.annotation.DateTimeFormat;

import java.time.LocalDate;
import java.util.Random;
import java.util.UUID;

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class ApplicationEntity {

    /** 申请ID */
    private String applicationId;
    /** 申请人学生学号 */
    private String studentId;
    /** 申请的房间类型 ('单人间', '双人间', '四人间')*/
    private RoomTypeEnumVO roomType;
    /** 租用开始日期 */
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private LocalDate startDate;
    /** 租用结束日期 */
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private LocalDate endDate;
    /** 申请状态 ('待审核', '已批准', '已拒绝') default '待审核' */
    private AppliStatusEnumVO status;

    public static String getRandomApplicationId(){
        return RandomStringUtils.randomNumeric(12);
    }
}
